﻿using System.Collections.Generic;

namespace TSharp.Core.Repository
{
    /// <summary>
    /// Generic repository interface (DDD) for reading domain entities to a storage.
    /// </summary>
    /// <typeparam name="TEntity">The type of the entity.</typeparam>
    /// <remarks>Created: 2011-12-26</remarks>
    public interface IReadonlyRepository<TEntity> where TEntity : class
    {
        /// <summary>
        /// Gets entity from the storage by it's Id.
        /// </summary>
        TEntity GetById(object id);

        ///// <summary>
        ///// Gets all entities of the type from the storage. 
        ///// </summary>
        //IList<TEntity> GetAll();

        /// <summary>
        /// Gets specification interface for complex searching for an entity or entities.
        /// </summary>
        /// <typeparam name="TSpecification">Concrete specification that will be resolved
        /// and initialized with underlying unit of work instance. This ensures fluent 
        /// and strongly typed way of connecting repository (uow) and specifications.</typeparam>
        TSpecification Specify<TSpecification>() where TSpecification : class, ISpecification<TEntity>;
        /// <summary>
        /// Specifies this instance.
        /// </summary>
        /// <returns></returns>
        ISpecification<TEntity> Specify();
    }
}